package cn.com.ksplatform.ui.loader;

import java.io.InputStream;

import org.apache.velocity.exception.ResourceNotFoundException;

import cn.com.ksplatform.ui.template.TemplateLoader;

public class ClasspathResourceLoader extends org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader{

	@Override
	public InputStream getResourceStream(String arg0)
			throws ResourceNotFoundException {
		if(arg0.startsWith("ui:")){
			String template = arg0.substring(3);
			//Log.info("load velocity template"+template);
			return TemplateLoader.loadTemplate(template);
		}else{
			return TemplateLoader.class.getClassLoader().getResourceAsStream(arg0);
		}
	}
	
}
